package IO;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class Demo06 {
    public static void main(String[] args) throws IOException {
//           务必要实现Closeable接口的类，才能放到try()里
        try (InputStream inputStream = new FileInputStream("d:/test.txt")){
            byte[] bytes = new byte[1024];
            int n = inputStream.read(bytes);
            for (int i = 0; i < n; i++) {
                System.out.printf("0x%x",bytes[n]);
            }
        }
//        java会自动close
    }
}
